Chris Pollett >Old Classes >
CS151

( Print View )

Student Corner:
  [Grades Sec5]

  [Submit Sec5]

  [Email List Sec5]

  [
Lecture Notes]

Course Info:
  [Texts & Links]
  [Topics]
  [Grading]
  [HW Info]
  [Exam Info]
  [Regrades]
  [Honesty]
  [Additional Policies]
  [Announcements]

HW Assignments:
  [Hw1]  [Hw2]  [Hw3]
  [Hw4]  [Hw5]

Practice Exams:
  [Mid1]  [Mid2]  [Final]

                           












CS151 Fall 2005Practice Final

To study for the midterm I would suggest you: (1) Know how to do (by heart) all the practice problems. (2) Go over your notes three times. Second and third time try to see how huch you can remember from the first time. (3) Go over the homework problems. (4) Try to create your own problems similar to the ones I have given and solve them. (5) Skim the relevant sections from the book. (6) If you want to study in groups, at this point you are ready to quiz each other. The practice final is below. Here are some facts about the actual final: (a) The final will be in class Monday, December 12 from 7:45pm to 10:00pm. (b) It is closed book, closed notes. Nothing will be permitted on your desk except your pen (pencil) and test. (c) You should bring photo ID. (d) There will be more than one version of the test. Each version will be of comparable difficulty. (e) If your cell-phone or beeper goes off you will be excused from the test at that point and graded on what you have done till your excusal. (f) One problem (less typos) on the actual test will be from the practice test.

[Student Generated Solutions-PDF]

1. Describe the differences between the Factory pattern, the Factory method pattern and the abstract Factory pattern. For each give a situation where it might be used.

2. What is the Model View Controller pattern?

3. Give a short code fragment that make use of Java 1.5 enumerated types.

4. Suppose we are designing the levels of a video game. We are interested in writing code to set up all the objects in each given level. Suggest what design patterns might we use and give your reasoning.

5. Suppose you are writing a word-processor and you want to support a undo-redo feature for editing. Give a design pattern one might use and explain briefly how the coding for this could be done.

6. Explain briefly with code how to create and start a thread that makes use of an object that implements Runnable.

7. Write a short code snippet which illustrate the use of the thread commands wait() and notify().

8. Explain and give a code example illustrating how to use the keyword synchronized.

9. Define the following thread-related terms: contention, deadlock.

10. Write a short code snippet which create a ServerSocket bound to port 1024 which then accepts incoming connections, and spawns a new thread to service this connection.